package amit.calc.form;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.NumberFormat;
import java.text.ParseException;

import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.WindowConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/**
 * The params entry form
 * @author ido
 *
 */
public class RentalPanel extends javax.swing.JPanel implements
		PropertyChangeListener {
	
	private JLabel propPriceLabel;
	private JLabel jLabel2;
	private JLabel jLabel4;
	private JLabel jLabel13;
	private JLabel jLabel8;
	private JLabel jLabel14;
	private JLabel jLabel12;
	private JLabel jLabel11;
	private JLabel jLabel10;
	private JLabel jLabel6;
	private JLabel jLabel5;
	private JLabel jLabel3;
	private JLabel jLabel7;
	private JLabel jLabel1;
	private JLabel jLabel9;
	
	private JFormattedTextField propPriceField;

	private JTextField linesOnTableField;
	private JFormattedTextField propValueGrowthField;
	private JFormattedTextField rentIncField;
	
	private JFormattedTextField homeOwnerFeeField;

	private JFormattedTextField downPaymentDollarField;
	
	private boolean weeksSpinnerChanged = false;
	private JSpinner occRateWeeksSpinner;
	private JTextField occupancyRateWeeksField;
	private JSpinner occupancyRateSpinner;
	private JFormattedTextField occupancyRateField;
	
	private JSpinner rentSpinner;
	private JFormattedTextField rentField;
	private JFormattedTextField managFeeField;

	private JFormattedTextField maintFeeField;
	private JFormattedTextField propTaxField;

	private JFormattedTextField downPaymentPercField;
	private JFormattedTextField mortgageRateField;

	private JFormattedTextField closingCostField;


	// Formats to format and parse numbers
	private NumberFormat amountDisplayFormat;
	private NumberFormat amountEditFormat;

	private NumberFormat percentDisplayFormat;
	private NumberFormat percentEditFormat;
	private NumberFormatter percentEditFormatter;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new RentalPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public RentalPanel() {
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			setUpFormats();
			GridBagLayout thisLayout = new GridBagLayout();
			thisLayout.rowWeights = new double[] { 0.0, 0.0, 0.1, 0.1, 0.1,
					0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
			thisLayout.rowHeights = new int[] { 30, 30, 20, 20, 20, 20, 20, 20,
					20, 7, 20, 20, 20, 20 };
			thisLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 0.1};
			thisLayout.columnWidths = new int[] {106, 87, 92, 20};
			this.setLayout(thisLayout);
			setMinimumSize(new java.awt.Dimension(550, 700));
			//this.setPreferredSize(new java.awt.Dimension(408, 373));
			propPriceLabel = new JLabel();
			this.add(propPriceLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
					0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			propPriceLabel.setText("Property Price");
			propPriceField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			propPriceField.setValue(new Double("50000"));
			propPriceField.addPropertyChangeListener("value", this);
			add(propPriceField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
					GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
					new Insets(0, 0, 0, 0), 0, 0));
			propPriceField.setBackground(new java.awt.Color(255, 128, 0));

			jLabel1 = new JLabel();
			this.add(jLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel1.setText("Closing Cost");

			closingCostField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			closingCostField.setValue(new Double("1000"));
			closingCostField.addPropertyChangeListener("value", this);
			add(closingCostField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
					GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
					new Insets(0, 0, 0, 0), 0, 0));

			jLabel2 = new JLabel();
			this.add(jLabel2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel2.setText("Mortgage Rate");

			jLabel3 = new JLabel();
			this.add(jLabel3, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel3.setText("Down Payment");

			mortgageRateField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							percentDisplayFormat), new NumberFormatter(
							percentDisplayFormat), percentEditFormatter));
			mortgageRateField.setValue(new Double("0.07"));
			mortgageRateField.addPropertyChangeListener("value", this);
			this.add(mortgageRateField,
					new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
			mortgageRateField.setBackground(new java.awt.Color(255, 128, 0));

			downPaymentDollarField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			downPaymentDollarField.addPropertyChangeListener("value", this);
			downPaymentDollarField.setMinimumSize(new Dimension(60,20));
			add(downPaymentDollarField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
			downPaymentDollarField.setSize(50, 20);
			downPaymentDollarField.setText(" ");

			downPaymentPercField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							percentDisplayFormat), new NumberFormatter(
							percentDisplayFormat), percentEditFormatter));
			
			downPaymentPercField.addPropertyChangeListener("value", this);
			this.add(downPaymentPercField,
					new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
			downPaymentPercField.setValue(new Double("0.3"));
			downPaymentPercField.addPropertyChangeListener("value", this);
			jLabel4 = new JLabel();
			this.add(jLabel4, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel4.setText("Property Taxes (Yaerly)");

			jLabel5 = new JLabel();
			this.add(jLabel5, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel5.setText("Maintenance fee (Yaerly)");

			jLabel6 = new JLabel();
			this.add(jLabel6, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel6.setText("Home owner Ins. (Yaerly)");

			propTaxField = new JFormattedTextField(new DefaultFormatterFactory(
					new NumberFormatter(amountDisplayFormat),
					new NumberFormatter(amountDisplayFormat),
					new NumberFormatter(amountEditFormat)));
			add(propTaxField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
					GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
					new Insets(0, 0, 0, 0), 0, 0));
			propTaxField.setValue(0);

			maintFeeField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			this.add(maintFeeField,
					new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
			maintFeeField.setValue(0);

			homeOwnerFeeField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			this.add(homeOwnerFeeField,
					new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
			homeOwnerFeeField.setValue(0);

			jLabel7 = new JLabel();
			this.add(jLabel7, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel7.setText("Management fee (Yaerly)");

			managFeeField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountDisplayFormat), new NumberFormatter(
							amountEditFormat)));
			this.add(managFeeField,
					new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
			managFeeField.setValue(0);

			jLabel8 = new JLabel();
			this.add(jLabel8, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel8.setText("Rent (per month)");

			rentSpinner = new JSpinner();
			rentSpinner.setValue(490);
		    JComponent editor = rentSpinner.getEditor();
		    rentField = ((JSpinner.DefaultEditor)editor).getTextField();
		    rentField.setFormatterFactory(new DefaultFormatterFactory(
					new NumberFormatter(amountDisplayFormat),
					new NumberFormatter(amountDisplayFormat),
					new NumberFormatter(amountEditFormat)));
		    rentSpinner.addPropertyChangeListener("value",this);
			add(rentSpinner, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0,
					GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
					new Insets(0, 0, 0, 0), 0, 0));
			rentSpinner.setBackground(new java.awt.Color(255, 255, 0));

			jLabel9 = new JLabel();
			this.add(jLabel9, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
			jLabel9.setText("Occupancy Rate");

			SpinnerNumberModel rateModel = new SpinnerNumberModel(0.9231d, 0.0d, 100.0d, 0.01d);
			occupancyRateSpinner = new JSpinner(rateModel);
		    JComponent occEditor = occupancyRateSpinner.getEditor();
		    occupancyRateField = ((JSpinner.DefaultEditor)occEditor).getTextField();
		    occupancyRateField.setMinimumSize(new Dimension(60,20));
			occupancyRateField.setFormatterFactory(
					new DefaultFormatterFactory(new NumberFormatter(
							percentDisplayFormat), new NumberFormatter(
							percentDisplayFormat), percentEditFormatter));
			occupancyRateSpinner.addChangeListener(new ChangeListener() {
				public void stateChanged(ChangeEvent e) {
					if ( !weeksSpinnerChanged) {
						int noWeeks = Math.round(Float.parseFloat(occupancyRateField.getText())/100 * 52);
						occRateWeeksSpinner.setValue(noWeeks);
						weeksSpinnerChanged = false;
					}
				}
			});
			add(occupancyRateSpinner, new GridBagConstraints(3, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
			
			
			
			jLabel10 = new JLabel();
			this.add(jLabel10, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			jLabel10.setText("Weeks");

			SpinnerNumberModel weeksModel = new SpinnerNumberModel(48, 0, 52, 1);
			occRateWeeksSpinner = new JSpinner(weeksModel);
			JComponent weekEditor = occupancyRateSpinner.getEditor();
			occupancyRateWeeksField = ((JSpinner.DefaultEditor)weekEditor).getTextField();
			occRateWeeksSpinner.addChangeListener(new ChangeListener () {
				public void stateChanged(ChangeEvent e) {
						double perc = Double.parseDouble(occRateWeeksSpinner.getValue().toString()) / 52d;
						weeksSpinnerChanged = true;
						occupancyRateSpinner.setValue(perc);
						weeksSpinnerChanged = false;
				}
				
			});
			this.add(occRateWeeksSpinner, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));


			jLabel11 = new JLabel();
			this.add(jLabel11, new GridBagConstraints(0, 11, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel11.setText("Rent Increase");

			jLabel12 = new JLabel();
			this.add(jLabel12, new GridBagConstraints(0, 12, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel12.setText("Property Value Growth");

			jLabel13 = new JLabel();
			this.add(jLabel13, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0,
					GridBagConstraints.WEST, GridBagConstraints.NONE,
					new Insets(0, 0, 0, 0), 0, 0));
			jLabel13.setText("Years to Show on Chart");

			rentIncField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							percentDisplayFormat), new NumberFormatter(
							percentDisplayFormat), percentEditFormatter));

			add(rentIncField,
					new GridBagConstraints(1, 11, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));

			propValueGrowthField = new JFormattedTextField(
					new DefaultFormatterFactory(new NumberFormatter(
							percentDisplayFormat), new NumberFormatter(
							percentDisplayFormat), percentEditFormatter));

			this.add(propValueGrowthField,
					new GridBagConstraints(1, 12, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));

			linesOnTableField = new JTextField("15");
			
			add(linesOnTableField,
					new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0,
							GridBagConstraints.CENTER,
							GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
									0), 0, 0));
	
				jLabel14 = new JLabel();
				this.add(jLabel14, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
				jLabel14.setText("Or");
	
			setBorder(BorderFactory.createTitledBorder("Finance Details"));

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void setUpFormats() {
		amountDisplayFormat = NumberFormat.getCurrencyInstance();
		amountDisplayFormat.setMinimumFractionDigits(0);
		amountEditFormat = NumberFormat.getNumberInstance();
		amountEditFormat.setMinimumFractionDigits(1);
		percentDisplayFormat = NumberFormat.getPercentInstance();
		percentDisplayFormat.setMinimumFractionDigits(2);
		percentEditFormat = NumberFormat.getNumberInstance();
		percentEditFormat.setMinimumFractionDigits(2);

		percentEditFormatter = new NumberFormatter(percentEditFormat) {
			public String valueToString(Object o) throws ParseException {
				Number number = (Number) o;
				if (number != null) {
					double d = number.doubleValue() * 100.0;
					number = new Double(d);
				}
				return super.valueToString(number);
			}

			public Object stringToValue(String s) throws ParseException {
				Number number = (Number) super.stringToValue(s);
				if (number != null) {
					double d = number.doubleValue() / 100.0;
					number = new Double(d);
				}
				return number;
			}
		};

	}

	public void propertyChange(PropertyChangeEvent e) {
		Object source = e.getSource();
		System.out.println("Got a change in field. e:" + e);
		if (downPaymentDollarField != null) {
			if (source == downPaymentPercField ) {
				Double payment = Double.parseDouble(downPaymentPercField.getValue().toString()) *
					Double.parseDouble(propPriceField.getValue().toString());
				downPaymentDollarField.setValue(payment);
			} else if (source == downPaymentDollarField && 
					downPaymentDollarField.getValue() != null) {
				if (downPaymentDollarField.getValue().toString().indexOf(".") < 0) {
					String tmpNo = downPaymentDollarField.getValue().toString() + ".0";
					downPaymentDollarField.setValue(new Double(tmpNo));
				}
				Double perc = Double.parseDouble(downPaymentDollarField.getValue().toString()) /
					Double.parseDouble(propPriceField.getValue().toString());
				downPaymentPercField.setValue(perc);
			}
		}
				
		if (source == rentSpinner) {
			// the user change the rent so calculate the table...
			
		}
		
		
		/*
		 * if (source == amountField) { amount =
		 * ((Number)amountField.getValue()).doubleValue(); } else if (source ==
		 * rateField) { rate = ((Number)rateField.getValue()).doubleValue(); }
		 * else if (source == numPeriodsField) { numPeriods =
		 * ((Number)numPeriodsField.getValue()).intValue(); }
		 */

		// double payment = computePayment(amount, rate, numPeriods);
		// paymentField.setValue(new Double(payment));
	}
			
	public JSpinner getRentSpinner() {
		return rentSpinner;
	}

	public JFormattedTextField getRentField() {
		return rentField;
	}

	public double getLoan() {
		return Double.parseDouble(propPriceField.getValue().toString()) - 
			   Double.parseDouble(downPaymentDollarField.getValue().toString());
	}

	public int getYears() {
		return Integer.parseInt(linesOnTableField.getText());
	}
	
	public double getInterest() {
		return Double.parseDouble(mortgageRateField.getValue().toString());
	}
	public double getRent() {
		return Double.parseDouble(rentField.getValue().toString());
	}

	public NumberFormat getAmountDisplayFormat() {
		return amountDisplayFormat;
	}

	public NumberFormat getAmountEditFormat() {
		return amountEditFormat;
	}

	public JFormattedTextField getClosingCostField() {
		return closingCostField;
	}

	public JFormattedTextField getDownPaymentDollarField() {
		return downPaymentDollarField;
	}

	public JFormattedTextField getDownPaymentPercField() {
		return downPaymentPercField;
	}

	public JFormattedTextField getHomeOwnerFeeField() {
		return homeOwnerFeeField;
	}

	public JLabel getJLabel1() {
		return jLabel1;
	}

	public JLabel getJLabel10() {
		return jLabel10;
	}

	public JLabel getJLabel11() {
		return jLabel11;
	}

	public JLabel getJLabel12() {
		return jLabel12;
	}

	public JLabel getJLabel13() {
		return jLabel13;
	}

	public JLabel getJLabel14() {
		return jLabel14;
	}

	public JLabel getJLabel2() {
		return jLabel2;
	}

	public JLabel getJLabel3() {
		return jLabel3;
	}

	public JLabel getJLabel4() {
		return jLabel4;
	}

	public JLabel getJLabel5() {
		return jLabel5;
	}

	public JLabel getJLabel6() {
		return jLabel6;
	}

	public JLabel getJLabel7() {
		return jLabel7;
	}

	public JLabel getJLabel8() {
		return jLabel8;
	}

	public JLabel getJLabel9() {
		return jLabel9;
	}

	public JTextField getLinesOnTableField() {
		return linesOnTableField;
	}

	public JFormattedTextField getMaintFeeField() {
		return maintFeeField;
	}

	public JFormattedTextField getManagFeeField() {
		return managFeeField;
	}

	public JFormattedTextField getMortgageRateField() {
		return mortgageRateField;
	}

	public JSpinner getOccRateWeeksSpinner() {
		return occRateWeeksSpinner;
	}

	public JFormattedTextField getOccupancyRateField() {
		return occupancyRateField;
	}

	public JSpinner getOccupancyRateSpinner() {
		return occupancyRateSpinner;
	}

	public JTextField getOccupancyRateWeeksField() {
		return occupancyRateWeeksField;
	}

	public NumberFormat getPercentDisplayFormat() {
		return percentDisplayFormat;
	}

	public NumberFormat getPercentEditFormat() {
		return percentEditFormat;
	}

	public NumberFormatter getPercentEditFormatter() {
		return percentEditFormatter;
	}

	public JFormattedTextField getPropPriceField() {
		return propPriceField;
	}

	public JLabel getPropPriceLabel() {
		return propPriceLabel;
	}

	public JFormattedTextField getPropTaxField() {
		return propTaxField;
	}

	public JFormattedTextField getPropValueGrowthField() {
		return propValueGrowthField;
	}

	public JFormattedTextField getRentIncField() {
		return rentIncField;
	}

	public boolean isWeeksSpinnerChanged() {
		return weeksSpinnerChanged;
	}
	
}
